package com.zzg.job;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.zzg.api.JobConfigService;
import com.zzg.entity.JobConfig;

@Component
public class MyJob implements Job {

	@Autowired
	private JobConfigService jobConfigService;

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		// TODO Auto-generated method stub
		 System.out.println(context.getJobDetail().getDescription());
	        SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	        System.out.println(this.toString() + ":" + f.format(new Date()) + "正在执行Job   executing...");
	        List<JobConfig> configs = jobConfigService.selectAll();
	        for (JobConfig config : configs) {
	            System.out.println(config.toString());
	        }
	}

}
